package application;

import java.util.ArrayList;
import java.util.Date;

import Utils.DateUtils;
import Utils.FileUtils;
import dao.StatusDao;
import dao.UserDao;

public class FileData {
	public static void computeUserIdStatusIntervals() {
		String result = "";
		ArrayList<String> userIds = UserDao.getAllIds();
		for (int i = 0; i < userIds.size(); i++) {
			String userId = userIds.get(i);
			ArrayList<Date> dateTimes = StatusDao.getStatusTimesByUserId(userId);
			ArrayList<Integer> intervals = DateUtils.getIntervals(dateTimes);
			result += userId + ":";
			for (int j = 0; j < intervals.size(); j++)
				result += intervals.get(j) + ",";
			result += "\n";
		}
		FileUtils.write("userId_statusIntervals.txt", result);
	}

	public static void main(String args[]) {
	}
}
